import { PropsWithChildren, useEffect } from "react";
import { observer } from "mobx-react-lite";
import { RootStore, RootStoreProvider } from "./mobx-rootstore";
// styles
import "./app.scss";

const App = observer(({ children }: PropsWithChildren<{}>) => {
  const rootStore = new RootStore();
  return (
    <RootStoreProvider store={rootStore}>
      <Init>{children}</Init>
    </RootStoreProvider>
  );
});

const Init = observer(({ children }: PropsWithChildren<{}>) => {
  // 初始化 deviceStore
  useEffect(() => {
    // 登录
    // eslint-disable-next-line react-hooks/exhaustive-deps
  }, []);
  return children as any;
});

export default App;
